﻿using System;
using System.Linq;
using Orange.Logistics.Models;
using Orange.Logistics.Infrastructure;
using Orange.Logistics.Services;
using System.Web.Mvc;

namespace Orange.Logistics.Controllers {

    public class PermissionController : BaseController<Permission> {

        private readonly IPermissionService service;

        public PermissionController(IPermissionService service)
            : base(service) {
            this.service = service;
        }

        protected override Func<Permission, object> GetOrderBy(string sort) {
            return (Permission p) => {
                switch (sort) {
                    case "Id":
                        return p.Id;
                    default:
                        return p.Id;
                }
            };
        }

        protected override void Dispose(bool disposing) {
            if (disposing) {
                service.Dispose();
            }
        }
    }
}